/*
*   行程轨迹查询方案
*   起点  终点  轨迹与绑路查询
*   命名空间  android   ios
* */

var routeTrack={
    /*android设备*/
    androidLoad:function(){
        var urls=baseAll.GetRequest(window.location.href);
        /*
        * @param token    token
        * @param account  用户账号
        * @param imeiId   imeiId查询轨迹的编号
        * */
        var sendData={
            token:AnroidWebActivity.getToken(),
            account:JSON.parse(AnroidWebActivity.getAuthorityState()).account,
            imeiId:urls.imeiId,
            distance:urls.distance,
            beginPos:urls.beginPosition,
            endPos:urls.endPosition,
            beginTime:urls.beginTime,
            endTime:urls.endTime
        };
        routeTrack.timeDrawTrack(sendData);
    },
    /*ios设备*/
    iosLoad:function () {

        baseAll.runWebViewJavascriptBridgeArr(function(data,responseCallback){
            var dataContent={};
            /*
            * 获取token-------
            * */
            WebViewJavascriptBridge.callHandler("getToken",null, function (response) {
                dataContent.token=response;
            });
            /*
            * 获取用户的手机号-------
            * */
            WebViewJavascriptBridge.callHandler("getAccount",null, function (response) {
                dataContent.account=response;
            });
            /*
           * 获取token账号-------
           * */
            WebViewJavascriptBridge.callHandler("getTrip",null, function (response) {
                dataContent.imeiId=response.activeCar.gprsImei;
                dataContent.beginPos=response.trip.begStr;
                dataContent.endPos=response.trip.endStr;
                dataContent.beginTime=response.trip.beginTime;
                dataContent.endTime=response.trip.endTime;
                dataContent.distance=response.trip.distance;
                routeTrack.timeDrawTrack(dataContent);
            });

        });
    },
    timeDrawTrack:function(sendData){
        MapRouteTrack(sendData);
    }
}